package at.btd.bsk;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.TextView;
import at.btd.bsk.entities.Trip;
import at.btd.bsk.util.Date;

public class SendTestDataDialog extends Dialog {

	public interface SendTestListener {
		public void doSendTestData(int velocity);
	}

	private SendTestListener readyListener;

	public SendTestDataDialog(Context context, SendTestListener readyListener) {
		super(context);

		this.readyListener = readyListener;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.saverun_dialog);
		setTitle(getContext().getResources().getString(R.string.arduino_sendTest));

		Button buttonSend = (Button) findViewById(R.id.buttonSave);
		

		buttonSend.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
			    EditText textVelocity = (EditText) findViewById(R.id.textVelocity);
			    int velocity = Integer.parseInt(textVelocity.getEditableText().toString());

				readyListener.doSendTestData(velocity);
				
				SendTestDataDialog.this.dismiss();
			}
		});
	}
}
